package cn.zzuisa.bluebox.base;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import org.apache.commons.collections.map.HashedMap;

public class RMap extends HashedMap {

	private static final long serialVersionUID = 1L;

	@Override
	public Object put(Object key, Object value) {
		if(value != null) {
			String type = value.getClass().getSimpleName();
			if(type.equals("Timestamp")) {
				Timestamp times = (Timestamp) value;
				LocalDateTime time = times.toLocalDateTime();
				String format = time.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
				return super.put(key, format);
			}else {
				return super.put(key, value);
			}
		}
		return super.put(key, value);
	}
}
